package com.ruoyi.project.cms.pro.service;

import com.ruoyi.project.cms.pro.mapper.ProFileMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.ruoyi.project.cms.pro.mapper.CmsImgMapper;
import com.ruoyi.project.cms.pro.domain.CmsImg;
import com.ruoyi.project.cms.pro.service.CmsImgService;

import java.util.List;

/**
 *com.ruoyi.project.cms.pro.service
 *作者：lh
 描述:
 *时间:2020-05-20
 */
@Service
public class CmsImgServiceImpl implements CmsImgService{

    @Resource
    private CmsImgMapper cmsImgMapper;

    @Resource
    private ProFileMapper proFileMapper;

    @Override
    public int deleteByPrimaryKey(Integer imgId) {
        return cmsImgMapper.deleteByPrimaryKey(imgId);
    }

    @Override
    public int insert(CmsImg record) {
        return cmsImgMapper.insert(record);
    }

    @Override
    public CmsImg selectByPrimaryKey(Integer imgId) {
        return cmsImgMapper.selectByPrimaryKey(imgId);
    }

    @Override
    public int updateByPrimaryKey(CmsImg record) {
        return cmsImgMapper.updateByPrimaryKey(record);
    }

    @Override
    public List<CmsImg> selectAll(CmsImg img) {
        return cmsImgMapper.selectAll(img);
    }

    @Override
    public CmsImg selectById(Integer proId) {

        Integer imgId=proFileMapper.selectByPrimaryKey(proId).getProImgId();
        return cmsImgMapper.selectById(imgId);
    }

}
